package com.jgp.glmeeting.service.impl;

import com.jgp.glmeeting.model.MeetingManagerRelation;
import com.jgp.glmeeting.repository.MeetingManagerRelationRepository;
import com.jgp.glmeeting.service.MeetingManagerRelationService;
import com.jgp.sys.common.query.Operator;
import com.jgp.sys.common.query.QueryFilterList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MeetingManagerRelationServiceImpl implements MeetingManagerRelationService {

    @Autowired
    private MeetingManagerRelationRepository meetingManagerRelationRepository;


    @Override
    public long deleteByMeetingId(String meetingId) {
        return meetingManagerRelationRepository.delete(new QueryFilterList().addFilter("meetingId", Operator.eq, meetingId));
    }

    @Override
    public void addMeetingManagerRelation(MeetingManagerRelation m) {
        meetingManagerRelationRepository.createOrUpdate(m);
    }

    @Override
    public List<MeetingManagerRelation> queryAll() {
        QueryFilterList queryFilterList=new QueryFilterList();
        return meetingManagerRelationRepository.read(queryFilterList);
    }
}
